#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

void printArray(vector<int> &arr) {
    for (auto it = arr.begin(); it != arr.end(); ++it) {
        cout << *it << " ";
    }
    cout << endl;
}

int main() {

    int n, m;

    cin >> n >> m;

    int opera[m][2];

    for (int i = 0; i < m; ++i) {
        cin >> opera[i][0] >> opera[i][1];
    }

    vector<int> res(n);

    for (int i = 1; i <=n; ++i) {
        res[i - 1] = i;
    }

    for (int i = 0; i < m; ++i) {
        if (opera[i][0] == 0) {
            sort(res.begin(), res.begin() + opera[i][1], greater<int>());
        } else {
            sort(res.begin() + opera[i][1] - 1, res.end());
        }
    }

    printArray(res);
    return 0;
}